# Debug utilities
#
# Copyright (C) 2010 Yotam Medini <yotam.medini@gmail.com>
#
# This file is part of Gupicasa.
#
# Gupicasa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Gupicasa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gupicasa.  If not, see <http://www.gnu.org/licenses/>.


import sys
import traceback

debug_on = False

def log(msg):
    global debug_on
    if debug_on:
        tb = traceback.extract_stack()
        caller = ""
        if len(tb) >= 2:
            e = tb[-2]
            caller = "%s:%d<%s> " % (e[0], e[1], e[2])
        sys.stderr.write("%s%s\n" % (caller, msg))


if __name__ == '__main__':


     class Dum_Class:

         def __init__(self):
             log("")

     d = Dum_Class()
     sys.exit(0)
